When to use Java (and when not to)

Java is being used more and more to implement market trading platforms, market models and quant research software.

Why Use Java

As a language Java is not substantially different from C++. What makes Java a much better choice than C++ in many cases is not the underlying language but the software environment.

  1. Java is truly portable. The same Java program will run on both Linux and Windows. This is not true of C++. C++ is a huge and complicated language and no two compilers from different sources implement the language in the same way. Only testing can assure that a C++ program will run across platforms. The lack of portability makes it easier to get locked in to a particular platform (for example, Windows), which reduces the options for system deployment.
  2. The software libraries and software components (like web servers) that are available for Java represent the largest body of reusable software that has ever been created. C++ cannot does not come close. These software packages are all free (no license fee and the source code is frequently available).
  3. The development environment for Java is excellent. The most commonly used tool is called http://www.eclipse.org/. Eclipse has a steep learning curve but once you get past this, Eclipse is a great development enviroment.
  4. Java integrates very closely with the so called "Web Services" environments which allow distributed applications to be created and managed much more easily.
  5. Java has very good Database support
  6. Java has very good networking support

Why Not to Use Java

  1. Applications that are entirely bound by CPU time and need to be as fast as possible should be written in C++
  2. Applications where a virtual machine (like the Java Virtual Machine, JVM) would not really work well. For example, the underlying database engines for database systems.
  3. Software that has to interface directly to the hardware (operating systems)
  4. Language processors that have to be fast (e.g., compilers)

These applications represent a small fraction of the software and in most cases I would use Java. I would, by the way, not use C. C++ has many advantages and has performance that is the same or very close to C.